{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 下载代码+安装环境+准备数据\n",
    "\n",
    "1. 参考doc/step1_build_project.md 中DINO相关的部分下载代码，安装环境\n",
    "2. 由于我们使用的是之前下载好的代码（detection_and_segmentation/DINO），因此在该代码下进行编译安装\n",
    "3. 上传并关联相关数据集到自己的目录下\n",
    "\n",
    "```sh\n",
    "# 将数据集 链接到 自己的目录下\n",
    "ln -s /apdcephfs_cq7/share_1447896/guozhizou/dataset/送标数据1234期 /apdcephfs_cq7/share_1447896/xuehuiyu/Workspace/work/link/advertisment1234\n",
    "\n",
    "cd /apdcephfs_cq7/share_1447896/xuehuiyu/Workspace/work/link/advertisment1234\n",
    "mkdir labels_plus annotations_plus\n",
    "cd labels_plus\n",
    "# upload warningwords的标注 (scp或者通过vscode)\n",
    "unzip warningwords.zip -d with_warningwords\n",
    "mv with_warningwords with_warningwords_tmp\n",
    "mv with_warningwords_tmp/warningwords/ with_warningwords && rm -rf with_warningwords_tmp/\n",
    "```\n",
    "\n",
    "4. 转换标注格式\n",
    "\n",
    "```sh\n",
    "source /apdcephfs_cq7/share_1447896/xuehuiyu/Util/miniconda3/bin/activate\n",
    "conda activate pt200cu117\n",
    "\n",
    "cd /apdcephfs_cq7/share_1447896/xuehuiyu/Workspace/work/link/advertisment1234\n",
    "# way 1：通过给定参考json获得images，一般用于二次创建\n",
    "python /apdcephfs_cq7/share_1447896/xuehuiyu/Workspace/work/ai_tech/scripts/biaobei_csv_to_coco_json.py \\\n",
    "  --csv labels_plus/with_warningwords --refer-json 'annotations/instances_val.json' --save-json 'annotations_plus/with_warningwords/instances_val.json'\n",
    "python /apdcephfs_cq7/share_1447896/xuehuiyu/Workspace/work/ai_tech/scripts/biaobei_csv_to_coco_json.py \\\n",
    "  --csv labels_plus/with_warningwords --refer-json 'annotations/instances_train.json' --save-json 'annotations_plus/with_warningwords/instances_train.json'\n",
    "\n",
    "# way 2: 通过给定图片路径获得images，一般用于首次创建\n",
    "python /apdcephfs_cq7/share_1447896/xuehuiyu/Workspace/work/ai_tech/scripts/biaobei_csv_to_coco_json.py \\\n",
    "  --csv labels_plus/with_warningwords --img 'images/val' --save-json 'annotations_plus/with_warningwords/instances_val.json'\n",
    "python /apdcephfs_cq7/share_1447896/xuehuiyu/Workspace/work/ai_tech/scripts/biaobei_csv_to_coco_json.py \\\n",
    "  --csv labels_plus/with_warningwords --img 'images/train' --save-json 'annotations_plus/with_warningwords/instances_train.json'\n",
    "\n",
    "```\n",
    "\n",
    "```sh\n",
    "# cd到DINO的项目目录中，如detection_and_segmentation/DINO/\n",
    "cd $DINO_HOME\n",
    "mkdir datasets/data\n",
    "ln -s /apdcephfs_cq7/share_1447896/xuehuiyu/Workspace/work/link/advertisment1234 datasets/data/advertisment1234\n",
    "```\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 训练模型\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.8.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
